package com.ws.client.action;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.opensymphony.xwork2.ActionSupport;
import com.ws.entity.Goods;
import com.ws.service.GoodsService;

@Component("cGoodsAction")
@Scope(value="prototype")
public class CGoodsAction extends ActionSupport {
	
	private List<Goods> goodsList=new ArrayList<Goods>();

	public List<Goods> getGoodsList() {
		return goodsList;
	}

	public void setGoodsList(List<Goods> goodsList) {
		this.goodsList = goodsList;
	}
	
	private GoodsService goodsService;
	
	@Resource(name="goodsServiceImpl")
	public void setGoodsService(GoodsService goodsService) {
		this.goodsService = goodsService;
	}

	public String goods_list(){
		goodsList=goodsService.getGoodsList();
		for(Goods goods : goodsList){
			System.out.println("goods : "+goods.getGoodsName());
		}
		return "goods_list";
	}
}
